package pers.kw.enums;

import java.util.HashSet;
import java.util.Set;

/**
 * 用户类型枚举
 */
public enum AuthUserTypeEnum {

    web_user("1", "kwsphere系统", "pers.kw.service.impl.WebUserDetailStrategyService"),
    test_user("2", "kwsphere系统", "pers.kw.service.impl.TestUserDetailStrategyService");

    private final String code;
    private final String mark;
    private final String userStrategy;

    AuthUserTypeEnum(String code, String mark, String userStrategy) {
        this.code = code;
        this.mark = mark;
        this.userStrategy = userStrategy;
    }

    public static final Set<String> userTypeSet = new HashSet<>();

    static {
        for (AuthUserTypeEnum item : AuthUserTypeEnum.values()) {
            userTypeSet.add(item.code);
        }
    }

    public String getUserStrategy() {
        return userStrategy;
    }

    public String getCode() {
        return code;
    }

    public String getMark() {
        return mark;
    }


    public static AuthUserTypeEnum getEnumObjByCode(String code) {
        for (AuthUserTypeEnum be : values()) {
            if (be.getCode().equals(code)) {
                return be;
            }
        }
        return null;
    }

}
